package databaseBL;

import java.rmi.RemoteException;

import po.Student;
import po.User;

import databaseBLService.DatabaseFactory;
import databaseBLService.DatabaseService;



public class DatabaseFactory_Stub<PO> implements DatabaseFactory{
	public static DatabaseService<User> userDatabase;
	public static DatabaseService<Student> studentDatabase;
	@SuppressWarnings("unchecked")
	public DatabaseFactory_Stub() {
		this.userDatabase = new DatabaseServiceImpl_Stub();
		this.studentDatabase = new DatabaseServiceImpl_Stub();
	}
	@SuppressWarnings({"unchecked" })
	public DatabaseService<User> getUserDatabase() throws RemoteException {
		if(userDatabase == null) {
			userDatabase = (DatabaseService<User>) new DatabaseFactory_Stub();	
		}
		return userDatabase;
	}

	@SuppressWarnings("unchecked")
	@Override
	public DatabaseService<Student> getStudentDatabase()
			throws RemoteException {
		// TODO Auto-generated method stub
		if(studentDatabase == null) {
			studentDatabase = (DatabaseService<Student>) new DatabaseFactory_Stub();
		}
		return studentDatabase;
	}

}